package org.loofer.uikit;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View.MeasureSpec;

public class AspectImageView extends AsyncRoundImageView {
    public AspectImageView(Context context) {
        super(context);
    }

    public AspectImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public AspectImageView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        setMeasuredDimension(getDefaultSize(0, widthMeasureSpec), getDefaultSize(0, heightMeasureSpec));
        int newWidthMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824) / 2;
        super.onMeasure(newWidthMeasureSpec, newWidthMeasureSpec);
    }
}
